<?php 
set_time_limit(0);

//Debug Execute Time Start
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $starttime = $mtime;
//Debug Execute Time Start

/*require_once("lib/execution_time.php");
$startTime = slog_time();*/


require_once("lib/IXR_Library.php.inc");

 
$client->debug = false; //Set it to false in Production Environment
 
// Create the client object


$client = new IXR_Client('http://bkkroad.com/xmlrpc.php');


 $home_url ="http://bkkroad.com/";
 $username = "admin"; 
 $password = "b123456"; 
  // Last parameter is 'true' which means post immideately, to save as draft set it as 'false'
 
 
 for($i=1;$i<=1;$i++){
// Run a query for PHP

$params = array(0,$username,$password,$content,true);



//require_once "amazon-one/test-get2.php";

$title="Test Amazon"; // $title variable will insert your blog title 
$body=file_get_contents('http://localhost/rpc/panel/amazon-one/test-get2.php', true); // $body will insert your blog content (article content)
 
$category="HDTV"; // Comma seperated pre existing categories. Ensure that these categories exists in your blog.
$keywords="keyword1, keyword2, keyword3";
 
//$customfields=array('key'=>'Author-bio', 'value'=>'Autor Bio Here'); // Insert your custom values like this in Key, Value format
 
 $customfields = array(  
 	                     array('key'=>'amazonproduct_item_noiframe_url','value'=>'http://rcm.amazon.com/e/cm?lt1=_blank&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=pingback-20&o=1&p=8&l=as1&m=amazon&f=ifr&asins=B003CNTZ6W'),
						 array('key'=>'awpkeyword','value'=>'HDTV'),
						 array('key'=>'awpraccitemasin','value'=>'B002TLTE6O,B003ES5ZPK,B003ES5ZUA,B003ES5ZRS,B003ES5ZR8,'),
						 array('key'=>'awpramazonproductitem','value'=>'<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=pingback-20&o=1&p=8&l=as1&m=amazon&f=ifr&asins=B003CNTZ6W" style="width:120px;height:250px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>'),
						 array('key'=>'awprasin','value'=>'B003CNTZ6W'),
						 array('key'=>'awprbrand','value'=>'Vizio'),
						 array('key'=>'awprbrand_sp','value'=>'Vizio'),
						 array('key'=>'awprinstock','value'=>'IN STOCK'),
						 array('key'=>'awprlargestimageurl','value'=>'http://ecx.images-amazon.com/images/I/41fafmeubLL.jpg'),
						 array('key'=>'awprlink','value'=>'http://www.amazon.com/VIZIO-M220VA-22-inch-Full-1080p/dp/B003CNTZ6W%3FSubscriptionId%3DAKIAJGW3D26PZORZCDSQ%26tag%3Dpingback-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB003CNTZ6W'),
						 array('key'=>'awprlistprice','value'=>'$ 229.99'),
						 array('key'=>'awprlowestnewpriceamount','value'=>'198.99'),
						 array('key'=>'awprlowestnewpricecurrencycode','value'=>'USD'),
						 array('key'=>'awprlowprice','value'=>'Only $ 198.99'),
						 array('key'=>'awprofferlisturl','value'=>'http://www.amazon.com/gp/offer-listing/B003CNTZ6W/?tag=pingback-20&ref=dp_olp_new&ie=UTF8&condition=new'),
						 array('key'=>'awprpercentsave','value'=>'13'),
						 array('key'=>'awprprice','value'=>'$ 198.99'),
						 array('key'=>'awprrating','value'=>'4.2'),
						 array('key'=>'awprratingimage','value'=>'<img src="http://localhost/wpamazon/wp-content/plugins/WPRobot3/images/rating_4.0.gif" alt="Rating: 4.2" class="starrating" />'),
						 array('key'=>'awprshortdescription','value'=>'With only a 0.75” thin profile*, the M220VA RazorLED™ LCD HDTV offers Full 1080p high definition resolution for crystal clear images, brilliant color, rich'),
						 array('key'=>'awprsidebarratingimage','value'=>'<img src="http://localhost/wpamazon/wp-content/plugins/WPRobot3/images/4.png" alt="Rating: 4.2" class="starrating" />'),
						 array('key'=>'awprsimilarasin','value'=>'B000ID7QNI,B0016CDE0E,B000M51NRM,B00155SXZ8,B0002L5R78,'),
						 array('key'=>'awprthumbnailurl','value'=>'http://ecx.images-amazon.com/images/I/41fafmeubLL._SL160_.jpg'),
						 array('key'=>'awprtitle','value'=>'VIZIO M220VA 22-inch Full HD 1080p 720p LED LCD HDTV'),
						 array('key'=>'awprtitle_sp','value'=>'VIZIO M220VA 22-inch Full HD 1080p ..'),
						 array('key'=>'ma_amazonpost','value'=>'s:50:"O:16:"SimpleXMLElement":1:{i:0;s:10:"B003CNTZ6W";}";'),
						 array('key'=>'_aioseop_description','value'=>'Big Save <a href="http://www.amazon.com/gp/offer-listing/B003CNTZ6W/?tag=pingback-20&ref=dp_olp_new&ie=UTF8&condition=new" rel="nofollow" title="Check Special Offers !!!">(13% OFF)</a> OFF on HDTV - VIZIO M220VA 22-inch Full HD 1080p 720p LED LCD HDTV.Lowest Price Guarantee.FREE with Super Saver Shipping.'),
						 array('key'=>'_aioseop_keywords','value'=>'HDTV')
 	                       );  
 
 
    $title = htmlentities($title,ENT_NOQUOTES,$encoding);
    $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
 
    $content = array(
        'title'=>$title." ".$i,
        'description'=>$body,
        'mt_allow_comments'=>0,  // 1 to allow comments
        'mt_allow_pings'=>0,  // 1 to allow trackbacks
        'post_type'=>'post',
        'mt_keywords'=>$keywords,
        'categories'=>array($category),
		'custom_fields' =>  $customfields
 
 
    );
	
	$params = array(0,$username,$password,$content,true);


if (!$client->query('metaWeblog.newPost', $params)) {
    die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
}
else echo $i." - Article Posted Successfully </br>";
	
 }
 
 
//Debug Execute Time End
  $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $endtime = $mtime;
   $totaltime = ($endtime - $starttime);
   echo "This page was created in ".$totaltime." seconds"; 
   /*$totalTime = elog_time($startTime);
    echo $totalTime;*/
//Debug Execute Time End  
   
?>